package com.example.spring.aop.tx.xml.dao.impl;

import com.example.spring.aop.tx.xml.dao.AccountDao;
import org.springframework.jdbc.core.JdbcTemplate;

public class AccountDaoImpl implements AccountDao {

    private JdbcTemplate jdbcT;

    public void setJdbcT(JdbcTemplate jdbcT) {
        this.jdbcT = jdbcT;
    }

    @Override
    public void out(String outer, int money) {
        String sql = "update accout set money = money - ? where username = ?";
        jdbcT.update(sql, money, outer);
    }

    @Override
    public void in(String inner, int money) {
        String sql = "update accout set money = money + ? where username = ?";
        jdbcT.update(sql, money, inner);
    }
}
